package com.lx.test;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.Date;

public class betweendays {
    public static void main(String[] args) throws ParseException {
//        JDK7
        String birthday = "2001年11月27日";
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
        Date date = sdf.parse(birthday);
        long time = date.getTime();
        long time2 = System.currentTimeMillis();
        System.out.println((time2-time)/1000/60/60/24);

//        JDK8
        LocalDate ld = LocalDate.of(2001,11,27);
        LocalDate ld2 = LocalDate.now();
        System.out.println(ChronoUnit.DAYS.between(ld, ld2));
    }
}
